public class Main {
   public static int[] tem;
    public static void sort(int[] arr,int left,int right){
        if(left>=right) return;
        int mid=(left+right)/2;
      sort(arr,left,mid);
        sort(arr,mid+1,right);
        int l=left,r=mid+1,i=0;
        while(l<=mid&&r<=right){
            if(arr[l]<arr[r]) tem[i++]=arr[l++];
            else tem[i++]=arr[r++];
        }
        while(l<=mid) tem[i++]=arr[l++];
        while(r<=right) tem[i++]=arr[r++];
        for(int j=left;j<=right;j++){
            arr[j]=tem[j-left];
        }
    }

    public static void main(String[] args) {
   int[] arr=new int[]{99,55,100,56,45,128,236,456,1,5,457};
   for(int x:arr){
       System.out.print(x+" ");
   }
    int n=arr.length;
    tem=new int[n];
        System.out.println();
    sort(arr,0,n-1);
        for(int x:arr){
            System.out.print(x+" ");
        }
    }
}
